package app.controller;

import java.awt.List;
import java.util.LinkedList;

import app.model.UserDaoImpl;
import app.model.UserEntity;

public class UserController {
	
	public static UserEntity loggedUser;
	private UserDaoImpl userImpl;
	public static boolean isAdmin;
	
	public UserController(){
		userImpl = UserDaoImpl.getInstance();
		
	}
	
	public LinkedList<UserEntity> getUsers(String name, String school, boolean isFollowed, String email){
		
		return userImpl.getAllUsers(name, school, isFollowed, email);
		
	}
	
	public boolean followUser(String follower, String followed){
		//UserEntity userThatFalow = userImpl.getUser(follower);
		//UserEntity UserToFalow = userImpl.getUser(followed);
		
		return loggedUser.createFollow(follower, followed);
	}
	
	public boolean changeProfile(String oldEmail, String newSchool, String newEmail, String name){
		System.out.println(oldEmail);

		UserEntity userEnt = new UserEntity(newEmail, name, newSchool, "");
		
		return userImpl.updateUser(userEnt, oldEmail);
	}
	
	public UserEntity getUser(String email) {
		return userImpl.getUser(email);	
	}
	
	public Object getUSerPhoto(String email){
		// Nosso modulo
		//ControladorFotografia ci = new ControladorFotografia();
		//return ci.mostrarFotoPerfil(email);
		return null;
	}
	
	public void setLoggedUser(String loggedUser){
		this.loggedUser = new UserEntity();
		this.loggedUser.setEmail(loggedUser);
	}
	
	public String getLoggedUser(){
		return this.loggedUser.getEmail();
	}
	
	public String[] getEscolas(){
		return userImpl.getEscolas();
		
	}
	
}
